package com.gitee.zhanyao.single.system.controller;

import com.gitee.zhanyao.single.system.model.MyMenu;
import com.gitee.zhanyao.single.system.service.SysMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/menus")
public class MenuController {

    @Autowired
    private SysMenuService sysMenuService;

    @GetMapping("/")
    public List<MyMenu> get() {
        List<MyMenu> myMenus = sysMenuService.getMyMenus();
        /*
        MyMenu myMenu1 = new MyMenu();
        myMenu1.setId("1");
        myMenu1.setName("菜单1");
        myMenu1.setIcon("fas fa-copy");
        myMenu1.setHref("/page/index");
        myMenu1.setTarget("_blank");
        myMenus.add(myMenu1);

        MyMenu myMenu2 = new MyMenu();
        myMenu2.setId("2");
        myMenu2.setName("系统管理");
        myMenu2.setIcon("fas fa-chart-pie");
        myMenu2.setIsActive(true);
        myMenu2.setIsOpen(false);
        myMenu2.setHasChildren(true);

        MyMenu myMenu3 = new MyMenu();
        myMenu3.setId("3");
        myMenu3.setName("图标管理");
        myMenu3.setIcon("fas fa-tree");
        myMenu3.setIsActive(true);
        myMenu3.setHref("/page/icon");
        myMenu3.setTarget("_self");
        myMenu2.getChildren().add(myMenu3);
        myMenus.add(myMenu2);
        */
        return myMenus;
    }

}
